package cn.itcast.dao;

import cn.itcast.domain.Account;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface AccountDao {
    @Select("select * from account")
    List<Account> findAll() throws Exception;

    @Select("select * from account where id = #{id}")
    Account findById(Integer id) throws Exception;

    @Update("update account set name = #{name}, money = #{money} where id = #{id}")
    void update(Account account) throws Exception;

    @Delete("delete from account where id = #{id}")
    void delete(Integer id) throws Exception;

    @Insert("insert into account (id,name,money) values (#{id},#{name},#{money})")
    void add(Account account) throws Exception;
}
